/*
 * @(#)AuditEventSslTcpReceiver.java
 * Date 2013-11-04
 * Version 1.0
 * Author Jim Horner
 * Copyright (c)2012
 */


package us.hornerscorners.lamppost.atna.receiver;


import com.nesscomputing.syslog4j.server.SyslogServer;

import com.nesscomputing.syslog4j.server.impl.net.tcp.ssl.SSLTCPNetSyslogServerConfig;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import us.hornerscorners.lamppost.ihecommon.config.AtnaConfig;
import us.hornerscorners.lamppost.ihecommon.config.AtnaProtocolType;


/**
 * Class description
 *
 *
 * @version        v1.0, 2013-11-04
 * @author         Jim Horner
 */
public class AuditEventSslTcpReceiver extends AbstractAuditEventReceiver {

    /** Field description */
    private final Logger logger = LoggerFactory.getLogger(getClass());

    /**
     * Constructs ...
     *
     * @param config
     */
    public AuditEventSslTcpReceiver(AtnaConfig config) {
        
        super(config, AtnaProtocolType.ssltcp);
    }

    /**
     * Method description
     *
     */
    @Override
    public void initialize() {

        SSLTCPNetSyslogServerConfig sysconfig = new SSLTCPNetSyslogServerConfig();

        AtnaConfig atnaConfig = getAtnaConfig();

        sysconfig.setHost(atnaConfig.getServiceHost());
        sysconfig.setPort(atnaConfig.getPort());
        sysconfig.setKeyStore(atnaConfig.getKeyStore());
        sysconfig.setKeyStorePassword(atnaConfig.getKeyStorePassword());
        sysconfig.setTrustStore(atnaConfig.getTrustStore());
        sysconfig.setTrustStorePassword(atnaConfig.getTrustStorePassword());
        
        SyslogServer.createInstance(getProtocol(), sysconfig);
    }
}
